﻿$("#exampleAccordion>li:nth-child(5) a").removeClass("collapsed");
$("#exampleAccordion>li:nth-child(5) ul").addClass("show");
$("#exampleAccordion>li:nth-child(5) ul>li:nth-child(1)").addClass("active");
$(function () {
	var columns = [{ "data": "GetNo", render: function (value, type, row) { return '<a href="javascript:void(0)" onclick="Pro(&apos;' + value + '&apos;,&apos;' + row.Name + '&apos;)">' + value + '</a>' } }, { "data": "Name", render: function (value, type, row) { return '<a href="javascript:void(0)" onclick="Pros(&apos;' + row.GetNo + '&apos;,&apos;' + value + '&apos;)">' + value + '</a>' } }, { "data": "Money" }, { "data": "AddDT" }, { "data": "JournalNO" }, { "data": "Id", render: function (value, type, row) { return '<a href="javascript:void(0)" class="btn btn-success btn-sm" onclick="OK(&apos;' + row.Id + '&apos;)">同意</a><a href="javascript:void(0)" class="btn btn-danger btn-sm pull-right" onclick="Defeated(&apos;' + row.Id + '&apos;)">不同意</a>' } }]
    dataTable.dataTables("/Index/Withdraws", columns, false)
    $("#dataTable_wrapper .row:last-child").addClass("mt-2");
})
//详情
function Pros(id, name) {
	var type = getCookie('jiangjin').split("&")[3].split("=")[1];
	var html = "";
	$.post('/Member/Detail', { id: id }, function (data, textStatus, xhr) {
		ID = id;
		
		html += '<div class="card-body">';
		html += '<table class="table table-bordered mb-0">';
		html += '<tbody>';
		html += '<tr>';
		html += '<td class="text-right">';
		html += '<strong>用户编号:</strong>';
		html += '</td>';
		html += '<td class="text-muted">' + data.Data.NO + '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td class="text-right"><strong>用户名:</strong></td>';
		html += '<td class="text-muted">' + data.Data.Name + '</td>';
		html += '</tr>';
		html += '</tr>';
		html += '<tr>';
		html += '<td class="text-right"><strong>身份证姓名:</strong></td>';
		html += '<td class="text-muted">' + data.Data.UserName + '</td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td class="text-right"><strong>用户等级:</strong></td>';
		html += '<td class="text-muted Grade"><span>' + data.Level + '</span></td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td class="text-right"><strong>安置人:</strong></td>';
		html += '<td class="text-muted"><span>' + data.EUP + '</span></td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td class="text-right"><strong>推荐人:</strong></td>';
		html += '<td class="text-muted"><span>' + data.MUP + '</span></td>';
		html += '</tr>';

		if (type == '07332506fa00992798c91411c89023a8') {
			html += '<tr>';
			html += '<td class="text-right"><strong>余额:</strong></td>';
			html += '<td class="text-muted">' + data.Data.Money + '<a class="pull-right text-danger" href="javascript:void(0)" onclick="pauseMoney(this)">' + (data.Data.IsMStop ? "开通" : "暂停") + '</a></td>';
			html += '</tr>';
			html += '<tr>';
			html += '<td class="text-right"><strong>冻结资金:</strong></td>';
			html += '<td class="text-muted">' + data.Data.Freeze + '</td>';
			html += '</tr>';
			html += '<tr>';
			html += '<td class="text-right"><strong>银行名称:</strong></td>';
			html += '<td class="text-muted">' + (data.Data.BankName == null ? "无" : data.Data.BankName) + '</td>';
			html += '</tr>';
			html += '<tr>';
			html += '<td class="text-right"><strong>银行卡号:</strong></td>';
			html += '<td class="text-muted">' + (data.Data.BankNO == null ? "无" : data.Data.BankNO) + '</td>';
			html += '</tr>';
			html += '<tr>';
		}
		html += '<td class="text-right"><strong>注册时间:</strong></td>';
		html += '<td class="text-muted"><span>' + data.AddDT + '</span></td>';
		html += '</tr>';
		html += '</tbody>';
		html += '</table>';
		html += '</div>';
		    layer.open({
        type: 1,
        title: name + '的申请人详情',
        shadeClose: true,
        shade: 0.8,
        area: ['70%', '80%'],
		content: html //iframe的url
	});
		console.log(html);
	});



	
}

//申请信息详情
function Pro(id, name) {
	layer.open({
		type: 2,
		title: name + '的申请人详情',
		shadeClose: true,
		shade: 0.8,
		area: ['70%', '80%'],
		content: '/Finance/GetOneJournal/?no=' + id //iframe的url
	});
}

//同意
function OK(id) {

	layer.confirm('确认同意提现申请吗?', { icon: 3, title: '提示' }, function (index) {
		//do something

		var option = {
			type: 'post',
			url: '/Order/ConfirmWithdraw',
			data: { id: id },
			callback: SetMode
		}
		swGather.swAjax(option)
		layer.close(index);
	});


}
//不同意
function Defeated(id) {
    layer.prompt({ title: '请输入不同意的原因', formType: 2 }, function (text, index) {
        layer.close(index);
        var option = {
            type: 'post',
            url: '/Order/ConfirmWithdraw',
            data: { id: id, content: text },
            callback: SetMode
        }
        swGather.swAjax(option)
    });
}

function SetMode(data) {
    layer.msg(data.Msg);
    setTimeout(function () {
        location.reload();
    }, 1500)
}